package config

var path = "conf/server.json"
var commonPsth = ""

//env var name
const (
	//log
	EnvLogLevel = "ENV_LOG_LEVEL"
	EnvLogPath  = "ENV_LOG_PATH"
	EnvLogFlag  = "ENV_LOG_FLAG"

	//etcd
	EnvEtcdBase = "ENV_ETCD_BASE"
	EnvEtcdAddr = "ENV_ETCD_ADDR"

	EnvEtcdHost = "ENV_ETCD_HOST"
	EnvEtcdPort = "ENV_ETCD_PORT"

	//other
	EnvHost     = "ENV_HOST"
	EnvHTTPPort = "ENV_HTTP_PORT"
	EnvTCPPort  = "ENV_TCP_PORT"
	EnvWSPort   = "ENV_WS_PORT"

	//DB
	EnvDBAddr         = "ENV_DB_ADDR"
	EnvDBUser         = "ENV_DB_USER"
	EnvDBPassword     = "ENV_DB_PASSWORD"
	EnvDBName         = "ENV_DB_NAME"
	EnvDBCoding       = "ENV_DB_CODING"
	EnvDBMaxIdelConns = "ENV_DB_MAX_IDLE_CONNS"
	EnvDBMaxOpenConns = "ENV_DB_MAX_OPEN_CONNS"

	//Redis
	EnvRedisAddr     = "ENV_REDIS_ADDR"
	EnvRedisPassword = "ENV_REDIS_PASS"
	EnvRedisDB       = "ENV_REDIS_DB"
)

type LogConfig struct {
	Level string
	Path  string
	Flag  int
}

//TODO: isolate server & user
type EtcdConfig struct {
	//common
	Base  string
	Etcds []string

	//server only
	Host           string
	Port           string
	ServiceAddress string //ServiceAddress = Host + Port

	//TODO: imp server
	// UpdateInterval    int64 //time.Duration

	//user only
	//TODO: imp user
	// Timeout    int64 //time.Duration
	// FailMode   int   //client.FailMode
	// SelectMode int   //client.SelectMode
}

type DBConfig struct {
	Addr         string
	UserName     string
	Password     string
	Name         string
	Coding       string
	MaxIdleConns int
	MaxOpenConns int
}

type RedisConfig struct {
	Addr     string
	PassWord string
	DB       int

	//TODO: add pool config
}
